package cn.wecloud.im.multiplayervideodemo.rtc

import org.webrtc.Logging
import org.webrtc.VideoFrame
import org.webrtc.VideoSink

class ProxyRenderer : VideoSink {

    @Synchronized
    override fun onFrame(frame: VideoFrame?) {
        if (target == null) {
            Logging.d("TAG", "Dropping frame in proxy because target is null.")
            return
        }
        target?.onFrame(frame)
    }

    private var target: VideoSink? = null


    @Synchronized
    fun setTarget(target: VideoSink?) {
        this.target = target
    }
}